<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('购物车X列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('edubuy:shopping:edit')}]];
    var removeFlag = [[${@permission.hasPermi('edubuy:shopping:remove')}]];
    var prefix = ctx + "edubuy/shopping";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "购物车X",
            columns: [
                {
                    field: 'shoppingId',
                    title: '购物车id',
                    visible: false
                },
                {
                    field: 'userId',
                    title: '用户'
                },
                {
                    field: 'shoppingShop',
                    title: '商品'
                },
                {
                    field: 'shoppingPrice',
                    title: '商品价格'
                },
                {
                    field: 'courseId',
                    title: '商品id',
                    visible: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push("<a class='btn btn-success btn-xs' href='show/buy?courseId=" + row.courseId + "')><i class='fa fa-gg'></i>购买</a> ");
                        actions.push("<br/><br/>");
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.shoppingId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
</script>
</body>
</html>